﻿using Zhp.Entity.Chat;
using Zhp.SqlSugar.Trigger;
using Zhp.SqlSugar.Trigger.Core;

namespace Zhp.Trigger.Service
{
    [Trigger("ChatUser")]
    public sealed class ChatUserTrigger : BaseTriggerService<ChatUser, long>
    {
        /// <summary>
        /// 删除聊天记录
        /// </summary>
        /// <param name="chatUser"></param>
        public override void Deleted(ChatUser chatUser)
        {
            Context.Deleteable<ChatMessage>().Where(x => x.BelongId == chatUser.Id).IsLogic().ExecuteCommand();
        }
    }
}